/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Administrator
 */
import java.util.*;

public class Main {

    public static Heap<Integer> heapqueue;
    public static JCFPriorityQueue<Integer> jcfqueue;

    public static void main(String[] args){

        heapqueue = new Heap();
        jcfqueue = new JCFPriorityQueue(1000);

        int[] randomNumbers = new int[1000];
        int firstone, lastone;

        for(int i = 0; i < randomNumbers.length; i ++){
            randomNumbers[i] = (int)(Math.random()*1000) + 1;
            heapqueue.add(randomNumbers[i]);
            jcfqueue.add(randomNumbers[i]);
        }
        System.out.println("Los 1000 numeros aleatorios han sido generados y almacenados");

        System.out.println("Heap:\nEl primer numero es:"+ getFirstHeap() +"\nEl ultimo elemento es:"+ getLastHeap());
        System.out.println("\nJCF;\nEl primer numero es:"+ getFirstJCF()+ "\nEl ultiimo elemento es:"+ getLastJCF());
    }

    public static Integer getFirstHeap(){
        return heapqueue.remove();
    }

    public static Integer getFirstJCF(){
        return jcfqueue.remove();
    }

    public static Integer getLastHeap(){
        Integer n = null;
        while (! heapqueue.isEmpty())
            n = heapqueue.remove();
        return n;
    }

    public static Integer getLastJCF(){
        Integer n = null;
        while (! jcfqueue.isEmpty())
            n = jcfqueue.remove();
        return n;
    }
}
